package com.web.manager.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.web.manager.mapper.CoursesectionMapper;
import com.web.manager.pojo.Coursesection;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

@Service
public class CoursesectionService extends ServiceImpl<CoursesectionMapper, Coursesection> {
    @Resource
    private CoursesectionMapper coursesectionMapper;

    @Override
    public boolean save(Coursesection entity){

        return super.save(entity);
    }


    public Coursesection selectByUsername(String type){
        QueryWrapper<Coursesection> queryWrapper = new QueryWrapper<>(); //条件查询器
        queryWrapper.eq("type",type);  // ==> where username = #{username}
        // 根据用户名查询数据库的用户信息
        return  this.getOne(queryWrapper); // ==>select * from manager_user where username = #{username}
    }
}
